<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/jsp/manage/common/taglibs.jsp"%>
<c:if test="${initParam['ssoEnable']=='true'}">
    <%@ include file="/WEB-INF/jsp/manage/common/ssoInclude.jsp" %>
</c:if>
<script type="text/javascript">
$(function() {
	$.acooly.framework.registerKeydown('manage_instChannelApi_searchform','manage_instChannelApi_datagrid');
});
/***
 * 加载选择的渠道对应备付金账户
 */
function load_manage_bfjaccount_datagrid() {
    $.acooly.framework.fireSelectRow('manage_instChannelApi_datagrid', function (row) {
        $.acooly.framework.loadGrid({
            gridId: "manage_bfjBankAccount_datagrid",
            url: '/manage/bfjbankaccount/bfjBankAccount/listJson.html',
            ajaxData: {"search_EQ_channelId": row.id}
        });
    }, '请先选择操作的渠道Api数据行');
}
/**
 *  备付金账户添加界面
 */
function create_manage_bfjaccount_add_view() {
    //判断是否选择渠道Api主表行，如果选择，则回调传入当前选中行的数据。
    $.acooly.framework.fireSelectRow('manage_instChannelApi_datagrid', function (row) {
        $.acooly.framework.create({
            url: '/manage/bfjbankaccount/bfjBankAccount/create.html',
            entity: 'bfjBankAccount',
            width: 800, height: 500,
            ajaxData: {'channelId': row.id}
        });
    }, '请先选择操作的渠道Api数据行');
}
/**
 * 备付金账户编辑
 */
function create_manage_bfjaccount_edit_view(sectionId) {
    //判断是否选择渠道Api主表行，如果选择，则回调传入当前选中行的数据。
    $.acooly.framework.fireSelectRow('manage_instChannelApi_datagrid', function (row) {
        $.acooly.framework.edit({
            url: '/manage/bfjbankaccount/bfjBankAccount/edit.html?date=' + new Date(),
            id: sectionId,
            entity: 'bfjBankAccount',
            width: 800, height: 500,
            ajaxData: {'channelId': row.id},
            onSuccess: function () {
                load_manage_bfjaccount_datagrid();
            }
        });
    }, '请先选择操作的渠道Api数据行');
}
</script>
<div class="easyui-layout" data-options="fit : true,border : false">
  <!-- 查询条件 -->
    <form id="manage_instChannelApi_searchform" onsubmit="return false">
        <table class="tableForm" width="100%">
            <tr>
                <td align="left">
                    <div>
                        渠道API编码: <input type="text" class="text" size="15" name="search_LIKE_gatewayChannelApi"/>
                        银行编码: <input type="text" class="text" size="15" name="search_LIKE_instBankId"/>
                        渠道状态: <select style="width:80px;height:27px;" name="search_EQ_status" editable="false" panelHeight="auto" class="easyui-combobox"><option value="">所有</option><c:forEach var="e" items="${allStatuss}"><option value="${e.key}" ${param.search_EQ_status == e.key?'selected':''}>${e.value}</option></c:forEach></select>
                        <a href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:false" onclick="$.acooly.framework.search('manage_instChannelApi_searchform','manage_instChannelApi_datagrid');"><i class="fa fa-search fa-lg fa-fw fa-col"></i>查询</a>
                    </div>
                </td>
            </tr>
        </table>
    </form>

  <!-- 列表和工具栏 -->
  <div data-options="region:'center',border:false" style="overflow: hidden;height:40%">
    <table id="manage_instChannelApi_datagrid" class="easyui-datagrid" url="${pageContext.request.contextPath}/manage/channel/instChannelApi/listJson.html" toolbar="#manage_instChannelApi_toolbar" fit="true" border="false" fitColumns="false"
      pagination="true" idField="id" pageSize="20" pageList="[ 10, 20, 30, 40, 50 ]" sortName="id" sortOrder="desc" checkOnSelect="true" selectOnCheck="true" singleSelect="true" data-options="onClickRow:load_manage_bfjaccount_datagrid">
      <thead>
        <tr>
        	<th field="showCheckboxWithId" checkbox="true" data-options="formatter:function(value, row, index){ return row.id }">编号</th>
			<th field="id" sum="true">ID</th>
			<th field="gatewayChannelApi">渠道API编码</th>
			<th field="gatewayChannelApiDesc">渠道API CODE 描述</th>
			<th field="quota" sum="true">渠道限额</th>
			<th field="dayQuota" sum="true">日限</th>
			<th field="rate" sum="true">渠道费率</th>
			<th field="instBankId">银行编码</th>
			<th field="status" formatter="mappingFormatter">渠道状态</th>
			<th field="extendField">扩展字段</th>
          	<th field="rowActions" data-options="formatter:function(value, row, index){return formatAction('manage_instChannelApi_action',value,row)}">动作</th>
        </tr>
      </thead>
    </table>

    <!-- 每行的Action动作模板 -->
    <div id="manage_instChannelApi_action" style="display: none;">
      <a onclick="$.acooly.framework.edit({url:'/manage/channel/instChannelApi/edit.html',id:'{0}',entity:'instChannelApi',width:500,height:400});" href="#" title="编辑"><i class="fa fa-pencil fa-lg fa-fw fa-col"></i></a>
      <a onclick="$.acooly.framework.show('/manage/channel/instChannelApi/show.html?id={0}',500,400);" href="#" title="查看"><i class="fa fa-file-o fa-lg fa-fw fa-col"></i></a>
      <a onclick="$.acooly.framework.remove('/manage/channel/instChannelApi/deleteJson.html','{0}','manage_instChannelApi_datagrid');" href="#" title="删除"><i class="fa fa-trash-o fa-lg fa-fw fa-col"></i></a>
    </div>

    <!-- 表格的工具栏 -->
    <div id="manage_instChannelApi_toolbar">
      <a href="#" class="easyui-linkbutton" plain="true" onclick="$.acooly.framework.create({url:'/manage/channel/instChannelApi/create.html',entity:'instChannelApi',width:800,height:500})"><i class="fa fa-plus-circle fa-lg fa-fw fa-col"></i>添加</a>
      <a href="#" class="easyui-linkbutton" plain="true" onclick="$.acooly.framework.removes('/manage/channel/instChannelApi/deleteJson.html','manage_instChannelApi_datagrid')"><i class="fa fa-trash-o fa-lg fa-fw fa-col"></i>批量删除</a>
    </div>
  </div>
    <!--备付金子列表-->
    <div data-options="region:'south',border:false" style="height:60%;">
        <div id="manage_businessrul_sub_tab" class="easyui-tabs" fit="true">
            <!-- 子列表: 备付金账号 -->
            <div title="备付金账号" style="margin-left: 0px;">
                <table id="manage_bfjBankAccount_datagrid" class="easyui-datagrid"  toolbar="#manage_bfjBankAccount_toolbar" fit="true" border="false" fitColumns="false"
                       pagination="true" idField="id" pageSize="20" pageList="[ 10, 20, 30, 40, 50 ]" sortName="id" sortOrder="desc" checkOnSelect="true" selectOnCheck="true" singleSelect="false">
                    <thead>
                    <tr>
                        <th field="showCheckboxWithId" checkbox="true" data-options="formatter:function(value, row, index){ return row.id }">编号</th>
                        <th field="channelId">渠道ID</th>
                        <th field="bankAccountName">备付金账户名</th>
                        <th field="bankAccountNo">备付金账号</th>
                        <th field="accountStatus" formatter="mappingFormatter">银行账户状态</th>
                        <th field="bankAccountType" formatter="mappingFormatter">银行账户类型</th>
                        <th field="fundType" formatter="mappingFormatter">资金类型</th>
                        <th field="savingType" formatter="mappingFormatter">存款类别</th>
                        <th field="infoQueryType" formatter="mappingFormatter">直联查询类别</th>
                        <th field="currency" formatter="mappingFormatter">币种</th>
                        <th field="bankId" formatter="mappingFormatter">合作银行</th>
                        <th field="memo" >备注</th>
                        <th field="rowActions" data-options="formatter:function(value, row, index){return formatAction('manage_bfjBankAccount_action',value,row)}">动作</th>
                    </tr>
                    </thead>
                </table>

                <!-- 每行的Action动作模板 -->
                <div id="manage_bfjBankAccount_action" style="display: none;">
                    <a onclick="create_manage_bfjaccount_edit_view('{0}');" href="#" title="编辑"><i class="fa fa-pencil fa-lg fa-fw fa-col"></i></a>
                    <a onclick="$.acooly.framework.show('/manage/bfjbankaccount/bfjBankAccount/show.html?id={0}',800,600);" href="#" title="查看"><i class="fa fa-file-o fa-lg fa-fw fa-col"></i></a>
                    <a onclick="$.acooly.framework.remove('/manage/bfjbankaccount/bfjBankAccount/deleteJson.html','{0}','manage_bfjBankAccount_datagrid',null,null,function(){load_manage_bfjaccount_datagrid();})" href="#" title="删除"><i class="fa fa-trash-o fa-lg fa-fw fa-col"></i></a>
                </div>

                <!-- 表格的工具栏 -->
                <div id="manage_bfjBankAccount_toolbar">
                    <a href="#" class="easyui-linkbutton" plain="true" onclick="create_manage_bfjaccount_add_view('{0}');"><i class="fa fa-plus-circle fa-lg fa-fw fa-col"></i>添加</a>
                    <a href="#" class="easyui-linkbutton" plain="true" onclick="$.acooly.framework.removes('/manage/bfjbankaccount/bfjBankAccount/deleteJson.html','manage_bfjBankAccount_datagrid',null,null,function(){load_manage_bfjaccount_datagrid();})"><i class="fa fa-trash-o fa-lg fa-fw fa-col"></i>批量删除</a>
                </div>
            </div>
        </div>
    </div>
</div>
